
#ifndef F_CPU
#define F_CPU 11059200UL
#endif
#include <avr/io.h>
#include <util/delay.h>
#include "LCD.h"
#include "PS2MS.h"

int main(void)
{
	/* Declarations */
	int16_t count_left;
	int16_t count_right;
	int16_t count_middle;
	mouseInit();
	/* initialize LCD display, cursor off */
	lcd_init(LCD_DISP_ON);
	lcd_clrscr();   /* clear display home cursor */
	lcd_putsxy("Mousey",0,0);
	

	while (1)
	{
		scanMouse();
		
		count_left=mouseY;
		count_right=mouseX;
		count_middle=mouseZ;
		
		lcd_putsxy("X",0,1);
		lcd_putixy(count_left,1,1,4);
		lcd_putsxy(" Y",5,1);
		lcd_putixy(count_right,7,1,4);
		lcd_putsxy("Z",11,1);
		lcd_putixy(count_middle,12,1,4);
		
		lcd_gotoxy(8,0);
		if(isLeft){
			lcd_puts("left");
		}
		else if(isRight){
			lcd_puts("right");
		}
		else if(isMiddle){
			lcd_puts("middle");
		}
		else{
			lcd_puts("no click");
		}
		_delay_ms(50);
	}
	return 1;
}